<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         Object.prototype.extends=function(obj){
            for(let key in obj){
                this[key]=obj[key];

            }
            return this;
        }

        var Pserson=function(){
            this.eat=function(){}
        }
        var China=function(){}
        var Indina=function(){}

        // 模拟继承
        China.prototype=(new Pserson()).extends({
            eat:function(){
                console.log("中国用筷子");
            }
        })
        Indina.prototype=(new Pserson()).extends({
            eat:function(){
                console.log("印度用筷子");
            }
        })
        var a=new China();
        var b=new Indina();
        a.eat();
        b.eat();
    </script>
</body>
</html>